package com.zhida.jiyangcenter.utils

import chooongg.base.manager.app
import chooongg.base.utils.isSpace

/**
 * 根据包名打开应用
 *
 * @param packageName 包名
 */
fun startApp(packageName: String) {
    if (isSpace(packageName)) return
    app.startActivity(app.packageManager.getLaunchIntentForPackage(packageName))
}

/**
 * 是否安装了指定包名的应用
 *
 * @param packageName 包名
 */
fun isInstallApp(packageName: String): Boolean {
    for (item in app.packageManager.getInstalledPackages(0)) {
        if (item.packageName.equals(packageName, true)) {
            return true
        }
    }
    return false
}
